home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / pcl / src-16f.lha / compiler / rt / params.lisp < prev    next >
Encoding:
Text File  |  1992-03-10  |  6.5 KB  |  220 lines

  1. ;;; -*- Package: RT; Log: c.log -*-
  2. ;;;
  3. ;;; **********************************************************************
  4. ;;; This code was written as part of the CMU Common Lisp project at
  5. ;;; Carnegie Mellon University, and has been placed in the public
  6. ;;; domain.  If you want to use this code or any part of CMU Common
  7. ;;; Lisp, please contact Scott Fahlman (Scott.Fahlman@CS.CMU.EDU)
  8. ;;; **********************************************************************
  9. ;;;
  10. ;;; $Header: params.lisp,v 1.12 92/03/10 08:57:55 wlott Exp $
  11. ;;;
  12. ;;; This file contains some parameterizations of various VM attributes for the
  13. ;;; IBM RT.  This file is separate from other stuff, so we can compile and
  14. ;;; load it earlier.
  15. ;;;
  16. ;;; Written by Rob MacLachlan
  17. ;;; Converted to MIPS by William Lott.
  18. ;;; Converted to IBM RT by William Lott and Bill Chiles.
  19. ;;;
  20.  
  21. (in-package "RT")
  22. (use-package "C")
  23.  
  24. (export '(word-bits byte-bits word-shift word-bytes float-sign-shift
  25.  
  26.       single-float-bias single-float-exponent-byte
  27.       single-float-significand-byte single-float-normal-exponent-min
  28.       single-float-normal-exponent-max single-float-hidden-bit
  29.       single-float-trapping-nan-bit single-float-digits
  30.  
  31.       double-float-bias double-float-exponent-byte
  32.       double-float-significand-byte double-float-normal-exponent-min
  33.       double-float-normal-exponent-max double-float-hidden-bit
  34.       double-float-trapping-nan-bit double-float-digits
  35.  
  36.       float-underflow-trap-bit float-overflow-trap-bit
  37.       float-imprecise-trap-bit float-invalid-trap-bit
  38.       float-divide-by-zero-trap-bit
  39.  
  40. ))
  41.  
  42.  
  43.  
  44. ;;;; Compiler constants.
  45.  
  46. (eval-when (compile eval load)
  47.  
  48. #-afpa (progn
  49. (setf *target-float-hardware* :mc68881)
  50. (setf (backend-name *target-backend*) "RT")
  51. (setf (backend-version *target-backend*) "IBM RT/Mach 1.0")
  52. (setf (backend-fasl-file-type *target-backend*) "rtf")
  53. (setf (backend-fasl-file-implementation *target-backend*)
  54.       rt-fasl-file-implementation)
  55. (setf *features* (delete :afpa *features*)))
  56.  
  57. #+afpa (progn
  58. (setf *target-float-hardware* :afpa)
  59. (setf (backend-name *target-backend*) "RT")
  60. (setf (backend-version *target-backend*) "IBM RT EAPC/Mach 1.0")
  61. (setf (backend-fasl-file-type *target-backend*) "eapcf")
  62. (setf (backend-fasl-file-implementation *target-backend*)
  63.       rt-afpa-fasl-file-implementation)
  64. (pushnew :afpa *features*))
  65.  
  66. (setf (backend-fasl-file-version *target-backend*) 1)
  67. (setf (backend-register-save-penalty *target-backend*) 3)
  68. (setf (backend-byte-order *target-backend*) :big-endian)
  69.  
  70. ) ;eval-when
  71.  
  72.  
  73.  
  74. ;;;; Machine Architecture parameters:
  75.  
  76. (eval-when (compile load eval)
  77.  
  78. (defconstant word-bits 32
  79.   "Number of bits per word where a word holds one lisp descriptor.")
  80.  
  81. (defconstant byte-bits 8
  82.   "Number of bits per byte where a byte is the smallest addressable object.")
  83.  
  84. (defconstant word-shift (1- (integer-length (/ word-bits byte-bits)))
  85.   "Number of bits to shift between word addresses and byte addresses.")
  86.  
  87. (defconstant word-bytes (/ word-bits byte-bits)
  88.   "Number of bytes in a word.")
  89.  
  90. (defparameter target-most-positive-fixnum (1- (ash 1 29))
  91.   "most-positive-fixnum in the target architecture.")
  92.  
  93. (defparameter target-most-negative-fixnum (ash -1 29)
  94.   "most-negative-fixnum in the target architecture.")
  95.  
  96. (defconstant float-sign-shift 31)
  97.  
  98. ;;; The exponent min/max values are wrong, I think.  The denorm, infinity, etc.
  99. ;;; info must go in there somewhere.
  100.  
  101. (defconstant single-float-bias 126)
  102. (defconstant single-float-exponent-byte (byte 8 23))
  103. (defconstant single-float-significand-byte (byte 23 0))
  104. (defconstant single-float-normal-exponent-min 1)
  105. (defconstant single-float-normal-exponent-max 254)
  106. (defconstant single-float-hidden-bit (ash 1 23))
  107. (defconstant single-float-trapping-nan-bit (ash 1 22))
  108.  
  109. (defconstant double-float-bias 1022)
  110. (defconstant double-float-exponent-byte (byte 11 20))
  111. (defconstant double-float-significand-byte (byte 20 0))
  112. (defconstant double-float-normal-exponent-min 1)
  113. (defconstant double-float-normal-exponent-max #x7FE)
  114. (defconstant double-float-hidden-bit (ash 1 20))
  115. (defconstant double-float-trapping-nan-bit (ash 1 19))
  116.  
  117. (defconstant single-float-digits
  118.   (+ (byte-size single-float-significand-byte) 1))
  119.  
  120. (defconstant double-float-digits
  121.   (+ (byte-size double-float-significand-byte) word-bits 1))
  122.  
  123. ); eval-when
  124.  
  125.  
  126.  
  127.  
  128. ;;;; Description of the target address space.
  129.  
  130. (export '(target-read-only-space-start
  131.       target-static-space-start
  132.       target-dynamic-space-start))
  133.  
  134. ;;; Where to put the different spaces.
  135. ;;; 
  136. (defparameter target-read-only-space-start #x00100000)
  137. (defparameter target-static-space-start    #x05000000)
  138. (defparameter target-dynamic-space-start   #x07000000)
  139.  
  140.  
  141.  
  142. ;;;; Other non-type constants.
  143.  
  144. (export '(halt-trap pending-interrupt-trap error-trap cerror-trap
  145.       breakpoint-trap function-end-breakpoint-trap))
  146.  
  147. (defenum (:suffix -trap :start 8)
  148.   halt
  149.   pending-interrupt
  150.   error
  151.   cerror
  152.   breakpoint
  153.   function-end-breakpoint)
  154.  
  155.  
  156.  
  157. ;;;; Static symbols.
  158.  
  159. (export '(static-symbols exported-static-symbols))
  160.  
  161.  
  162. ;;; These symbols are loaded into static space directly after NIL so
  163. ;;; that the system can compute their address by adding a constant
  164. ;;; amount to NIL.
  165. ;;;
  166. ;;; The exported static symbols are a subset of the static symbols that get
  167. ;;; exported to the C header file.  NOTE: EXPORTED-STATIC-SYMBOLS IS DEFINED
  168. ;;; AS A FUNCTION OF THE ORDERING OF THIS LIST.
  169. ;;;
  170. (defparameter static-symbols
  171.   '(t
  172.  
  173.     ;; Random stuff needed for initialization.
  174.     lisp::lisp-environment-list
  175.     lisp::lisp-command-line-list
  176.  
  177.     ;; Functions that C needs to call.
  178.     lisp::%initial-function
  179.     lisp::maybe-gc
  180.     kernel::internal-error
  181.     di::handle-breakpoint
  182.  
  183.     ;; Free Pointers and the like
  184.     lisp::*read-only-space-free-pointer*
  185.     lisp::*static-space-free-pointer*
  186.     lisp::*initial-dynamic-space-free-pointer*
  187.     *allocation-pointer*
  188.     *internal-gc-trigger*
  189.     *binding-stack-pointer*
  190.  
  191.     ;; Things needed for non-local-exit.
  192.     lisp::*current-catch-block*
  193.     lisp::*current-unwind-protect-block*
  194.     *eval-stack-top*
  195.  
  196.     ;; Interrupt Handling
  197.     lisp::*pseudo-atomic-atomic*
  198.     lisp::*pseudo-atomic-interrupted*
  199.     unix::*interrupts-enabled*
  200.     unix::*interrupt-pending*
  201.     lisp::*free-interrupt-context-index*
  202.  
  203.     ;; Static functions.
  204.     two-arg-+ two-arg-- two-arg-* two-arg-/ two-arg-< two-arg-> two-arg-=
  205.     %negate two-arg-and two-arg-ior two-arg-xor
  206.     length two-arg-gcd two-arg-lcm truncate
  207.     ))
  208.  
  209. (defparameter exported-static-symbols
  210.   (subseq static-symbols 0 (1+ (position 'lisp::*free-interrupt-context-index*
  211.                      static-symbols))))
  212.  
  213.  
  214.  
  215. ;;;; Assembler parameters:
  216.  
  217. ;;; The number of bits per element in the assemblers code vector.
  218. ;;;
  219. (defparameter *assembly-unit-length* 8)
  220.